package com.example.demo01.controller;

import com.example.demo01.entity.Middle;
import com.example.demo01.entity.MiddleRole;
import com.example.demo01.entity.Role;
import com.example.demo01.mapper.RoleMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.List;

@Api(tags="role")
@RestController
@EnableSwagger2
public class RoleController {
    @Autowired
    private RoleMapper role;
    @ApiOperation(value = "角色表信息插入")
    @GetMapping("/Add")
    public int AddUser(Role roles){
        return role.insert(roles);
    }
    @ApiOperation(value = "角色信息删除")
    @GetMapping("/deleterole")
    public int delete(int id){
        return role.delete(id);
    }

    @ApiOperation(value = "角色模糊查询")
    @GetMapping("/SelectRoleName")
    public List<Role> getname(String rolename){
        return role.getname(rolename);
    }
    @ApiOperation(value = "角色显示列表")
    @GetMapping("/Print")
    public List<MiddleRole> getname01(int id,String rolename,String counts){
        return role.getname01(id,rolename,counts);
    }
}
